import Vue from 'vue'


// 1.装包 yarn add vue-router@3.5.3
// 2.引入到mian.js VueRouter是一个构造函数
import VueRouter from 'vue-router'
//引入组件对象
import Find from '../views/Find.vue'
import My from '../views/My.vue'
import Part from '../views/Part.vue'
import NotFound from '../views/NotFound.vue'

// 3.安装VueRouter插件
Vue.use(VueRouter)
// 4.创建路由对象
// 核心步骤配置路由规则
const routes = [
  {
    path:'/', //默认hash值路径
    redirect:'/find' //重定向到find组件

  },
  {
    path:'/find',
    component:Find,
  },
  {
    path:'/my/',
    component:My,
  },
  {
    path:'/part',
    component:Part,
  },
  {
    path:'*',
    component:NotFound
  }
]
//创建路由对象
const router = new VueRouter({
  routes,
  mode:'history'
})

export default router
